<%-- 
    Document   : test
    Created on : Oct 6, 2013, 2:45:28 AM
    Author     : yoko
--%>

<%@page import="java.util.jar.Attributes.Name"%>
<%@page import="org.apt.matrimony.beans.CityBeans"%>
<%@page import="java.util.List"%>
<%@page import="org.apt.matrimony.beans.CountryBeans"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <script>window.alert("hi");</script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript" src="js/Default.js"></script>
        <script>
            function filterContent() {
    var user = document.getElementById("country").value;
    var contentA = document.getElementById("city");
     if(user=="select") {
        contentA.style.display="none";
     }else{
         contentA.disabled=false;
        contentA.style.display="block";
     }
}
        </script>
        <script>
             var xmlHttp;
      function showCity(str){
      if (typeof XMLHttpRequest != "undefined"){
        xmlHttp= new XMLHttpRequest();
        }
      else if (window.ActiveXObject){
        xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
        }
      if (xmlHttp==null){
      alert("Browser does not support XMLHTTP Request")
      return;
      }
      var url="city.jsp";
      url +="?count=" +str;
      xmlHttp.onreadystatechange = cityChanged;
      xmlHttp.open("GET", url, true);
      xmlHttp.send(null);
      }
      function cityChanged(){
      if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
      document.getElementById("city").innerHTML=xmlHttp.responseText
      }
      }
        </script>
    </head>
    <body>
        <% String p=request.getParameter("city");%>

                This is city id:<label><%=p%></label>
        <jsp:useBean id="list" scope="session" class="org.apt.matrimony.methods.selects"></jsp:useBean>
        <h1>Hello World!</h1>
        <form action="check" post="post"></form>
       <select name="country" class="width_100" id="country" onchange="showCity(str);">

            <option value="select" selected>-Select-</option>
                                                                <%
                                                                List<CountryBeans> countryList=list.selectAllCountries();
                                                                    for(int i=0; i<countryList.size();i++){
                                                                    %>
                                                                    <option value="<%= countryList.get(i).getCountry_Id() %>"><%= countryList.get(i).getCountry_Name() %></option>
                                                                <%}%>
                                                                <option value="other">-other-</option>
         </select>
                             
  <div id='city'>
      <select name='city' >
      <option value='-1'></option>
      </select>
      </div>
    </body>
</html>
